package com.ms.common.bean;

import com.ms.common.utils.SpringContextHolder;

import java.io.Serializable;


public class Message implements Serializable{

	public enum Type {
		success, warn, error;
	}

	private Type type;
	private String content;

	public Message(Type type, String content, Object args[]) {
		this.type = type;
		this.content = SpringContextHolder.getMessage(content, args);
	}

	public Message(Type type, String content){
		this.type = type;
		this.content = content;
	}

	public static Message success(String content) {
		return new Message(Type.success, content);
	}

	public static Message success(String content, Object args[]) {
		return new Message(Type.success, content, args);
	}

	public static Message warn(String content, Object args[])
	{
		return new Message(Type.warn, content, args);
	}

	public static Message warn(String content)
	{
		return new Message(Type.warn, content);
	}
	public static Message error(String content, Object args[]) {
		return new Message(Type.error, content, args);
	}

	public static Message error(String content) {
		return new Message(Type.error, content);
	}

	public Type getType() {
		return type;
	}

	public void setType(Type type) {
		this.type = type;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

}
